*Conevska 2021, ISQ Replication (see memo for details) 



****** Table 1 *********

use "/replication-files/natdis_august2020.dta"

*labelling the variables for tables
label variable logtomz_gdp_67_A "GDP (Country A)"
label variable logtomz_gdp_67_B "GDP (Country B)"
label variable naturaldisasters "Natural Disasters"
label variable naturaldis_damage "Natural disaster damage"
label variable naturaldis_deaths "Natural disaster deaths"
label variable lntotaldamage "ln(Total Damage)"
label variable lntotaldeaths "ln(Total Deaths)"
label variable gattwto "GATT/WTO"
label variable deeppta "Deep PTA"
label variable ln_exports "ln(Exports)"
label variable democ_A "Democracy (Country A)"
label variable democ_B "Democracy (Country B)"


*making table 
xtreg ln_exports naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using table1, label ctitle(`lnExports') dec(2) keep(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) sortvar(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) tex(frag) append 

xtreg ln_exports naturaldisasters lntotaldamage naturaldis_damage lntotaldeaths logtomz_gdp_67_A logtomz_gdp_67_B gattwto deeppta i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using table1, label ctitle(`lnExports') dec(2) keep(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) sortvar(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) tex(frag) append 

xtreg ln_exports naturaldisasters lntotaldeaths naturaldis_deaths lntotaldamage logtomz_gdp_67_A logtomz_gdp_67_B gattwto deeppta i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using table1, label ctitle(`lnExports') dec(2) keep(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B logpop_pwt_A logpop_pwt_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) sortvar(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) tex(frag) append 

xtreg ln_exports naturaldisasters lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths logtomz_gdp_67_A logtomz_gdp_67_B gattwto deeppta i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using table1, label ctitle(`lnExports') dec(2) keep(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B logpop_pwt_A logpop_pwt_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) sortvar(naturaldisasters logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto lntotaldamage lntotaldeaths naturaldis_damage naturaldis_deaths) tex(frag) append 




**** Table 4 *****
ssc install xtivreg2
ssc install ivreg2
ssc install ranktest

xtset ID_dyad year

**depth 
xtreg d.logem l.logem d.deeppta l.deeppta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto i.year if naturaldisasters==1, fe cluster(ID_dyad) robust
outreg2 using table4, keep(d.logem l.logem d.deeppta l.deeppta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto) tex(frag) append 

xtreg d.logem l.logem d.deeppta l.deeppta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto i.year if naturaldisasters==0, fe cluster(ID_dyad) robust
outreg2 using table4, keep(d.logem l.logem d.deeppta l.deeppta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto) tex(frag) append 

	
	* LRM - one stage Bewly Transformation 
     xi: xtivreg2 logem d.deeppta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.deeppta l.logpop_pwt_A l.logpop_pwt_B l.gattwto (d.logem = l.logem d.deeppta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.deeppta l.logpop_pwt_A l.logpop_pwt_B l.gattwto) i.year if naturaldisasters==1, fe cluster(ID_dyad) 	
     xi: xtivreg2 logem d.deeppta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.deeppta l.logpop_pwt_A l.logpop_pwt_B l.gattwto (d.logem = l.logem d.deeppta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.deeppta l.logpop_pwt_A l.logpop_pwt_B l.gattwto) i.year if naturaldisasters==0, fe cluster(ID_dyad) 	


	 
**enforce
xtreg d.logem l.logem d.enfpta l.enfpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto i.year if naturaldisasters==1, fe cluster(ID_dyad) robust
outreg2 using table4, keep(d.logem l.logem d.deeppta l.deeppta d.enfpta l.enfpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto) tex(frag) append 

xtreg d.logem l.logem d.enfpta l.enfpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto i.year if naturaldisasters==0, fe cluster(ID_dyad) robust
outreg2 using table4, keep(d.logem l.logem d.deeppta l.deeppta d.enfpta l.enfpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto) tex(frag) append 

	
	
     xi: xtivreg2 logem d.enfpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.enfpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto (d.logem = l.logem d.enfpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.enfpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto) i.year if naturaldisasters==1, fe cluster(ID_dyad) 	
     xi: xtivreg2 logem d.enfpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.enfpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto (d.logem = l.logem d.enfpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.enfpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto) i.year if naturaldisasters==0, fe cluster(ID_dyad) 	

	 
	 
	 
**flex
xtreg d.logem l.logem d.flexpta l.flexpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto i.year if naturaldisasters==1, fe cluster(ID_dyad) robust
outreg2 using table4, keep(d.logem l.logem d.deeppta l.deeppta d.enfpta l.enfpta d.flexpta l.flexpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto) tex(frag) append 

xtreg d.logem l.logem d.flexpta l.flexpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto i.year if naturaldisasters==0, fe cluster(ID_dyad) robust
outreg2 using table4, keep(d.logem l.logem d.deeppta l.deeppta d.enfpta l.enfpta d.flexpta l.flexpta d.logpop_pwt_A l.logpop_pwt_A d.logpop_pwt_B l.logpop_pwt_B d.gattwto l.gattwto) tex(frag) append 

	
	
     xi: xtivreg2 logem d.flexpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.flexpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto (d.logem = l.logem d.flexpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.flexpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto) i.year if naturaldisasters==1, fe cluster(ID_dyad) 	
     xi: xtivreg2 logem d.flexpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.flexpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto (d.logem = l.logem d.flexpta d.logpop_pwt_A d.logpop_pwt_B d.gattwto l.flexpta l.logpop_pwt_A l.logpop_pwt_B l.gattwto) i.year if naturaldisasters==0, fe cluster(ID_dyad) 	




	 
	 
***** Table 5 ******* 
use "/replication-files/natdis_august2020.dta"
label variable naturaldis_dem "Natural disaster x Democracy"

xtreg ln_exports naturaldisaster democ_A democ_B naturaldis_dem i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tabledem_rr, label ctitle(`lnExports') dec(3) keep(naturaldisaster democ_A democ_B naturaldis_dem) sortvar(naturaldisaster democ_A democ_B naturaldis_dem) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

xtreg ln_exports naturaldisaster deeppta natdisaster_deeppta i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tabledem_rr, label ctitle(`lnExports') dec(3) keep(naturaldisaster democ_A democ_B naturaldis_dem deeppta natdisaster_deeppta) sortvar(naturaldisaster democ_A democ_B naturaldis_dem deeppta natdisaster_deeppta) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

xtreg ln_exports naturaldisaster democ_B deeppta natdisaster_deeppta democ_A naturaldis_dem i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tabledem_rr, label ctitle(`lnExports') dec(3) keep(naturaldisaster democ_A democ_B naturaldis_dem deeppta natdisaster_deeppta) sortvar(naturaldisaster democ_A democ_B naturaldis_dem deeppta natdisaster_deeppta) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

	 
	 
***** Table 7  ******
use "/replication-files/natdis_august2020.dta"
 
xtreg ln_exports geophysical logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tablenew1, dec(2) keep(geophysical logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) sortvar(geophysical logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

xtreg ln_exports meteorological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tablenew1, dec(2) keep(geophysical meteorological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) sortvar(geophysical meteorological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

xtreg ln_exports hydrological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tablenew1, dec(2) keep(geophysical meteorological hydrological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) sortvar(geophysical meteorological hydrological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

xtreg ln_exports climatological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tablenew1, dec(2) keep(geophysical meteorological hydrological climatological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) sortvar(geophysical meteorological hydrological climatological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 

xtreg ln_exports geophysical meteorological hydrological climatological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto i.year if year >= 1995, fe cluster(ID_dyad) robust
outreg2 using tablenew1, dec(2) keep(geophysical meteorological hydrological climatological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) sortvar(geophysical meteorological hydrological climatological logtomz_gdp_67_A logtomz_gdp_67_B deeppta gattwto) addtext(Year Fe, Yes, Dyad Fe, Yes, Country-Year Fe, No) tex(frag) append 



***** Table 9 *******
estpost tabstat deeppta  M democ_A democ_B TotalDamage TotalDeaths naturaldisasters drought landslide wildfire storm earthquake flood, casewise statistics( sd max mean min ) columns(statistics) 
eststo sumstats 
esttab sumstats using summarystats.tex, cell ("sd max mean min ") mtitle("Table 1 Summary Statistics") replace




	 
********Figure 2*************
xtreg ln_exports naturaldisasters##c.lntotaldeaths logtomz_gdp_67_A logtomz_gdp_67_B gattwto deeppta i.year if year >= 1995, fe cluster(ID_dyad) robust
margins, dydx(naturaldisasters) at(lntotaldeaths = (1(1)13)) atmeans
marginsplot, scheme(sj) recastci(rarea) ci1opts(fintensity(30)) yline(0)



















